package br.com.android.boaviagem;

import android.content.Intent;
import android.graphics.DashPathEffect;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.Toast;

import com.actionbarsherlock.app.SherlockActivity;
import com.actionbarsherlock.view.Menu;

public class BoaViagemActivity extends SherlockActivity {

	private EditText login;
	private EditText senha;
	
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.login);
		
		login = (EditText) findViewById(R.id.usuario);
		senha = (EditText) findViewById(R.id.senha);
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		getSupportMenuInflater().inflate(R.menu.main, menu);
		return true;
	}
	
	public void loginOnClick(View v) {
		String username = login.getText().toString();
		String password = senha.getText().toString();
		
		if ("admin".equals(username) && "admin".equals(password)) {
			startActivity( new Intent(this, DashboardActivity.class));
		} else {
			String errorMessage = getString(R.string.authentication_error);
			Toast.makeText(this, errorMessage, Toast.LENGTH_SHORT).show();
		}
	}

}
